Skip to content

fix: preserve rewritten join-key filters after joins - #20976

Open
umrndem wants to merge 1 commit into
apache:masterfrom
umrndem:fix-stacked-join-virtual-filter
Open

umrndem wants to merge 1 commit into
apache:masterfrom
umrndem:fix-stacked-join-virtual-filter

Conversation

@umrndem

@umrndem umrndem commented Nov 29, 2026

Copy link
Copy Markdown

Fixes #20975.

Description

Keep the original RHS filter after rewriting a join-key predicate for pushdown. The rewritten filter can still match base rows whose LEFT JOIN result is null, so it cannot replace the post-join check. OR filters now preserve that check too. The rewritten base-table filter still gets pushed down.

Added regressions for direct and OR filters, plus the reported stacked join query across the existing join contexts. The analyzer, join cursor and SQL join suites pass: 716 tests passed and 2 skipped.

Release note

Fixed: filters on boolean values computed from a LEFT JOIN no longer include unmatched rows when another LEFT JOIN is stacked on top.

Key changed/added classes in this PR
  • JoinFilterAnalyzer
  • JoinFilterAnalyzerTest
  • CalciteJoinQueryTest

This PR has:

  • been self-reviewed.
  • a release note entry in the PR description.
  • added comments explaining the intent of the change.
  • added unit tests to cover the affected code paths.

@FrankChen021 FrankChen021 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No actionable issues found. The analyzer now preserves rewritten join-key filters after joins, including direct rewrites inside OR clauses, so null-extended outer-join rows remain subject to the original predicate.

Reviewed 3 of 3 changed files, including the production analyzer and both modified test files, plus relevant join-filter and cursor call paths.

Validation: git diff --check passed; no builds or tests were run.


This is an automated review by Codex GPT-5.6-Luna(max)

@FrankChen021 FrankChen021 added the Approval Recommended Used when AI completes a review and reports no findings label Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approval Recommended Used when AI completes a review and reports no findings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong results: WHERE on a column computed from a LEFT JOIN is ignored when another LEFT JOIN is stacked on top

2 participants